package jp.co.lkg.springsmp.services.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import jp.co.lkg.springsmp.common.Page;
import jp.co.lkg.springsmp.common.dao.UserinfoDao;
import jp.co.lkg.springsmp.common.db.dto.UserinfoDto;
import jp.co.lkg.springsmp.services.UserinfoService;



@Component
public class UserinfoServiceImpl implements UserinfoService{

	@Autowired
	private UserinfoDao userinfoDao;
	
	@Override
	public UserinfoDto selectByPk(UserinfoDto dto) {
		// TODO Auto-generated method stub
		return userinfoDao.selectByPk(dto);
	}

	@Override
	public List<UserinfoDto> select(UserinfoDto dto) {
		// TODO Auto-generated method stub
		return userinfoDao.select(dto);
	}

	@Override
	public void insert(UserinfoDto dto) {
		// TODO Auto-generated method stub
		userinfoDao.insert(dto);
	}

	@Override
	public void updateByPk(UserinfoDto dto) {
		// TODO Auto-generated method stub
		userinfoDao.updateByPk(dto);
	}

	@Override
	public void deleteByPk(UserinfoDto dto) {
		// TODO Auto-generated method stub
		userinfoDao.deleteByPk(dto);
	}

	@Override
	public void updateIncludeNull(UserinfoDto dto) {
		// TODO Auto-generated method stub
		userinfoDao.updateIncludeNull(dto);
	}

	@Override
	public String findStatus(String username) {
		// TODO Auto-generated method stub
		return userinfoDao.findStatus(username);
	}

	@Override
	public String findId(String username) {
		// TODO Auto-generated method stub
		return userinfoDao.findId(username);
	}

	@Override
	public Page selectPage(Integer currPage, UserinfoDto dto) {
		Page page =new Page();
		if(currPage==null) currPage=1;
		page.setCurrPage(currPage);
		int Count =userinfoDao.selectAllPage();
		page.setTotalSize(Count);
		page.initTotalPage();
		page.setMinnumber(currPage);
		page.setMaxnumber(currPage);
		dto.setMaxnumber(page.getMaxnumber());
		dto.setMinnumber(page.getMinnumber());
		page.setUserlist(userinfoDao.selectAllUser(dto));
		return page;
	}

	@Override
	public List<UserinfoDto> selectAllUser(UserinfoDto dto) {
		// TODO Auto-generated method stub
		return userinfoDao.selectAllUser(dto);
	}

	

	
}
